# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgbase=lua-loadkit
_rockname=${pkgbase#lua-}
pkgname=("$pkgbase" "lua51-$_rockname" "lua52-$_rockname" "lua53-$_rockname")
pkgver=1.1.0
_rockrel=1
pkgrel=1
pkgdesc='allows you to load arbitrary files within the Lua package path'
arch=(any)
url="https://github.com/leafo/$_rockname"
license=(MIT)
makedepends=(lua
             lua51
             lua52
             lua53
             luarocks)
# checkdepends=(busted moonscript)
_archive="$_rockname-$pkgver"
source=("$url/archive/v$pkgver/$_archive.tar.gz"
        "$url/releases/download/v$pkgver/$_archive-$_rockrel.rockspec")
sha256sums=('39742dd5db94f13886810cf69fc9b3db89bba3180c060384136115c9da431196'
            '5404ec4cad62351e35c196ee87810ab3977405b7d94fe9a8dc5f64906007dd21')

# check() {
#     cd "$_archive"
#     busted
# }

_package() {
	cd "$_archive"
	depends=("${pkgname%-*}")
	luarocks --lua-version="$1" --tree="$pkgdir/usr/" \
		make --deps-mode=none --no-manifest "../$_archive-$_rockrel.rockspec"
}

package_lua-loadkit() {
	_package 5.4
}

package_lua51-loadkit() {
	_package 5.1
}

package_lua52-loadkit() {
	_package 5.2
}

package_lua53-loadkit() {
	_package 5.3
}
